#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time: 2022/9/16 19:54
# @Author: 张涛
# @Email: xxx@gmail.com
# @File：chanpin_tj_page.py

from selenium.webdriver.common.by import By
from pages.base_page import BasePage

"""
产品添加页面
"""

class AddProduct(BasePage):
    kftd_locator = (By.ID,'development_team') #定位开发团队
    cpmc_locator = (By.ID,'name') #定位产品名称
    dwwwb_locator = (By.XPATH,'/html/body/div[5]/div[2]/div[2]/form/table/tbody/tr[7]/td[2]/t'
                              'able/tbody/tr/td[4]/div/input') #选择文件
    bctj_locator = (By.XPATH,'/html/body/div[5]/div[2]/div[2]/form/table/tfoot/tr/td/input[1]') #保存添加

    def kftd_element(self,kftd_a):
        '''输入开发团队'''
        self.driver.find_element(*self.kftd_locator).send_keys(kftd_a)

    def cpmc_element(self,cpmc_b):
        '''输入产品名称'''
        self.driver.find_element(*self.cpmc_locator).send_keys(cpmc_b)

    def bctj_element(self):
        '''点击保存添加'''
        self.driver.find_element(*self.bctj_locator).click()

    def dwwwb_element(self,tupian):
        '''选择文件'''
        self.driver.find_element(*self.dwwwb_locator).send_keys(tupian)

    def tpmc_element(self):
        '''获取文件内容'''
        tpmc_a = self.driver.find_element(*self.dwwwb_locator).text
        return tpmc_a

